# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=m4
pkgver=1.4.17
pkgrel=4
pkgdesc="The GNU macro processor"
arch=('i686' 'x86_64')
url="http://www.gnu.org/software/m4"
license=('GPL3')
groups=('base-devel')
depends=('bash' 'gcc-libs' 'msys2-runtime')
makedepends=('')
install=m4.install
source=(ftp://ftp.gnu.org/gnu/m4/$pkgname-$pkgver.tar.xz{,.sig}
        m4-1.4.17-msys2.patch)
md5sums=('12a3c829301a4fd6586a57d3fcf196dc'
         'SKIP'
         'e967bcaf11419550ca2c49e63ece9890')

prepare() {
  cd ${srcdir}/$pkgname-$pkgver
  patch -p1 -i ${srcdir}/m4-1.4.17-msys2.patch

  autoreconf -fi
}

build() {
  cd ${srcdir}/$pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --with-syscmd-shell=/usr/bin/sh
  make
}

check() {
  cd ${srcdir}/$pkgname-$pkgver
  make check
}

package() {
  cd ${srcdir}/$pkgname-$pkgver
  make prefix=${pkgdir}/usr install
}
